<template lang="pug">
div
    el-table(ref="multipleTable" :data="td" tooltip-effect="dark" style="width: 100%" 
            v-loading="loading" element-loading-text="数据加载中...")
        el-table-column(prop="goodId" label="商品编号")
        el-table-column(prop="goodName" label="商品名称")
        el-table-column(prop="spec" label="单位")
        el-table-column(prop="price" label="单价/元")
        el-table-column(prop="adjustNum" label="调货量")
        el-table-column(prop="outShopName" label="调货方")
        el-table-column(prop="inShopName" label="收货方")
        el-table-column(label="调货时间")
            template(slot-scope="scope")
                span {{scope.row.adjustTime | format}}
        el-table-column(prop="remark" label="备注")
    el-row
        el-pagination(@size-change="handleSizeChange" @current-change="handleCurrentChange" style="float:right"
        :current-page="currentPage" :page-size="10" layout="total, prev, pager, next, jumper" :total="count")
</template>
<script>
import moment from 'moment'
export default{
    props:['gde'],
    data(){
        return{
            td:[],
            loading:false,
            currentPage:1,
            count:0
        }
    },
    filters:{
        format(v){
            return moment(v).format("YYYY-MM-DD")
        }
    },
    computed:{
        getid(){
            return this.$store.state.jxcdetial
        }
    },
    watch:{
        getid(v){
            var pp=new URLSearchParams()
            pp.append('goodId',this.$store.state.jxcdetial)
            if(!this.$store.state.shiro){
                pp.append('shopId',this.$store.state.TOPshopID)
            }
            this.getData(pp)
        }
    },
    activated(){
        
    },
    methods:{
        handleSizeChange(i){
            this.topage(i)
        },
        handleCurrentChange(i){
            this.topage(i)
        },
        topage(i){
            var pp=new URLSearchParams()
            pp.append('pageNo',i)
            pp.append('goodStockId',this.$store.state.jxcdetial)
            if(!this.$store.state.shiro){
                pp.append('shopId',this.$store.state.TOPshopID)
            }
            this.getData(pp)
        },
        getData(v){
            var _this=this
            this.loading=true
            this.td=[]
            axios.get('/findAdjustList.do',{params:v}).then(r=>{
                // console.log(r)
                if(r.data.code==200){
                    _this.td=[].concat(r.data.response.adjustList)
                    _this.count=r.data.response.page.totalCount
                    _this.loading=false
                }else{
                    _this.$message.error(r.data.message)
                    _this.loading=false
                }
            })
        }
    }
}
</script>